<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文件分享链接</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f5f7fa;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            color: #333;
        }
        .container {
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            padding: 30px;
            width: 90%;
            max-width: 500px;
            text-align: center;
        }
        h1 {
            color: #4a6ee0;
            margin-bottom: 20px;
        }
        p {
            color: #666;
            margin-bottom: 25px;
            line-height: 1.6;
        }
        .success-icon {
            font-size: 64px;
            color: #4CAF50;
            margin-bottom: 20px;
        }
        .link-container {
            background-color: #f0f5ff;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 25px;
            position: relative;
        }
        .share-link {
            word-break: break-all;
            font-size: 16px;
            color: #4a6ee0;
            margin: 0;
            padding-right: 40px;
        }
        .copy-btn {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: #4a6ee0;
            cursor: pointer;
            font-size: 18px;
        }
        .copy-btn:hover {
            color: #3a5ecc;
        }
        .file-info {
            background-color: #f9f9f9;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 25px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .file-icon {
            font-size: 24px;
            color: #666;
            margin-right: 10px;
        }
        .file-name {
            font-weight: 500;
            word-break: break-all;
        }
        .btn {
            background-color: #4a6ee0;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            transition: background-color 0.3s;
            text-decoration: none;
            display: inline-block;
            margin: 5px;
        }
        .btn:hover {
            background-color: #3a5ecc;
        }
        .btn-outline {
            background-color: transparent;
            color: #4a6ee0;
            border: 1px solid #4a6ee0;
        }
        .btn-outline:hover {
            background-color: #f0f5ff;
        }
        .expiry-info {
            margin-top: 20px;
            font-size: 14px;
            color: #ff6b6b;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .expiry-icon {
            margin-right: 5px;
        }
        .tooltip {
            position: absolute;
            background-color: #333;
            color: white;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 12px;
            bottom: 100%;
            left: 50%;
            transform: translateX(-50%);
            white-space: nowrap;
            opacity: 0;
            transition: opacity 0.3s;
            pointer-events: none;
        }
        .copy-btn:hover .tooltip {
            opacity: 1;
        }
        footer {
            margin-top: 30px;
            font-size: 12px;
            color: #999;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body>
    <div class="container">
        <div class="success-icon">
            <i class="fas fa-check-circle"></i>
        </div>
        <h1>文件上传成功</h1>
        <p>您的文件已成功上传，可以使用以下链接分享给他人</p>
        
        <div class="file-info">
            <div class="file-icon">
                <i class="fas fa-file"></i>
            </div>
            <div class="file-name">{{ filename }}</div>
        </div>
        
        <div class="link-container">
            <p class="share-link" id="share-url">{{ share_url }}</p>
            <button class="copy-btn" id="copy-btn" onclick="copyShareLink()">
                <i class="far fa-copy"></i>
                <span class="tooltip" id="tooltip">复制链接</span>
            </button>
        </div>
        
        <div class="expiry-info">
            <span class="expiry-icon"><i class="fas fa-exclamation-circle"></i></span>
            此链接将在24小时后自动失效
        </div>
        
        <div style="margin-top: 25px;">
            <a href="/" class="btn btn-outline">返回首页</a>
            <a href="{{ share_url }}" class="btn">下载文件</a>
        </div>
        
        <footer>
            &copy; 2025 临时文件分享服务
        </footer>
    </div>

    <script>
        function copyShareLink() {
            const shareUrl = document.getElementById('share-url');
            const tooltip = document.getElementById('tooltip');
            
            // 创建一个临时文本区域
            const textArea = document.createElement('textarea');
            textArea.value = shareUrl.textContent;
            document.body.appendChild(textArea);
            
            // 选择文本并复制
            textArea.select();
            document.execCommand('copy');
            
            // 移除临时文本区域
            document.body.removeChild(textArea);
            
            // 更新提示文本
            tooltip.textContent = '已复制!';
            
            // 2秒后恢复原始提示文本
            setTimeout(() => {
                tooltip.textContent = '复制链接';
            }, 2000);
        }
    </script>
</body>
</html>